<?php

namespace app\adminapi\validate;

use app\common\validate\BaseValidate;

class SysDictDataValidate extends BaseValidate
{
    protected $rule = [
        'pageNo' => 'regex:/^([1-9]\d*)$/',
        'pageSize' => ['regex'=>'/^(-1|[1-9]\d*)$/'],
        'dictDataId' => 'require|number',
        'dictDataSort' => 'require|number',
        'dictDataName' => 'require',
        'dictDataValue' => 'require',
        'dictType' => 'require'
    ];

    protected $message = [
        'pageNo.regex' => '分页页码只能是数字',
        'pageSize.regex' => '分页页大小只能是数字',
        'dictDataId.require' => '字典数据参数不完整',
        'dictDataId.number' => '字典数据ID类型错误',
        'dictDataSort.require' => '请输入字典数据排序',
        'dictDataSort.number' => '字典数据排序类型错误',
        'dictDataName.require' => '请输入字典数据标签',
        'dictDataValue.require' => '请输入字典数据值',
        'dictType.require' => '请输入字典类型'
    ];

    protected $scene = [
        'list' => ['pageNo', 'pageSize'],
        'insert' => ['dictType', 'dictDataSort', 'dictDataName', 'dictDataValue'],
        'delete' => ['dictDataId'],
        'query' => ['dictDataId'],
        'update' => ['dictDataId', 'dictDataName', 'dictDataValue', 'dictType'],
        'getDataByType' => ['dictType']
    ];
}